ML Tutorial 50 TensorFlow Question

by: shaobin675, 7 years ago


Hello Harrison,
  How are you?
  I run the exact code in the tutorial 50, but I got the error as the following:
InvalidArgumentError (see above for traceback): logits and labels must be same size: logits_size=[100,10] labels_size=[100,2]
[[Node: SoftmaxCrossEntropyWithLogits_10 = SoftmaxCrossEntropyWithLogits[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](Reshape_30, Reshape_31)]]

Please advise!
Thank you!



You must be logged in to post. Please login or register an account.



This suggests to me that you possibly didn't update n_classes. What we're seeing here is that your labels have 2 possibilities (100,2) ... but the logits have 100 x 10, so your network is outputting 10 nodes, which suggests to me that you didn't modify fully the old code.

-Harrison 7 years ago

You must be logged in to post. Please login or register an account.


Right! It does work!
I was wondering How x and y are going to get their value? I mean after
 prediction = neural_network_model(x) 
, all of a sudden, in softmax_cross_entropy_with_logits, y is a [100, 2] tensor object. How does that happen? and I cannot find a way to check the value for tensor object, such as x, y, prediction.
Thank you!

-shaobin675 7 years ago

You must be logged in to post. Please login or register an account.